/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package P_DOMIN;

/**
 *
 * @author Ornella
 */

import java.sql.*;
import java.sql.DriverManager;
public class I_ninos extends javax.swing.JPanel {

    /**
     * Creates new form I_ninos
     */
    public I_ninos() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jtpppal = new javax.swing.JTabbedPane();
        jPInfoNino = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jTf_PNombNino = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTf_Snomb_nino = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        jLabel7 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jComboBox1 = new javax.swing.JComboBox();
        jTextField4 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jLabel13 = new javax.swing.JLabel();
        jRadioButton5 = new javax.swing.JRadioButton();
        jRadioButton6 = new javax.swing.JRadioButton();
        jLabel14 = new javax.swing.JLabel();
        jRadioButton7 = new javax.swing.JRadioButton();
        jRadioButton8 = new javax.swing.JRadioButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jPInfoFamiliares = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jTextField7 = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jTextField10 = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jTextField11 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPinfoResponsables = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        jLabel1.setText("INFORMACION DE NIÑOS DE ESCUELA DOMINICAL");

        jtpppal.setToolTipText("En esta seccion podra ingresar los datos basicos del niño");

        jPInfoNino.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setText("Primer Nombre");
        jPInfoNino.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 161, -1, -1));
        jPInfoNino.add(jTf_PNombNino, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 158, 299, -1));

        jLabel3.setText("Segundo Nombre");
        jPInfoNino.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 161, -1, -1));
        jPInfoNino.add(jTf_Snomb_nino, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 158, 199, -1));

        jLabel4.setText("Primer Apellido");
        jPInfoNino.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 189, -1, -1));
        jPInfoNino.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 184, 240, -1));

        jLabel5.setText("Segundo Apellido");
        jPInfoNino.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 189, -1, -1));
        jPInfoNino.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 189, 199, -1));

        jLabel6.setText("Edad");
        jPInfoNino.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 215, -1, -1));
        jPInfoNino.add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 210, 77, -1));
        jPInfoNino.add(jDateChooser1, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 215, 199, -1));

        jLabel7.setText("Sexo");
        jPInfoNino.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 241, -1, -1));

        jRadioButton1.setText("M");
        jPInfoNino.add(jRadioButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 232, -1, -1));

        jRadioButton2.setText("F");
        jPInfoNino.add(jRadioButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 232, -1, -1));

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jPInfoNino.add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 241, 199, -1));
        jPInfoNino.add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 261, 293, -1));

        jLabel8.setText("Fecha de Nacimiento");
        jPInfoNino.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 216, -1, -1));

        jLabel9.setText("Barrio");
        jPInfoNino.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 241, -1, -1));

        jLabel10.setText("Direccion");
        jPInfoNino.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 267, -1, -1));

        jLabel11.setText("Telefono");
        jPInfoNino.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 264, -1, -1));
        jPInfoNino.add(jTextField5, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 261, 199, -1));

        jLabel12.setText("Cristiano");
        jPInfoNino.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 304, -1, -1));

        jRadioButton3.setText("Si");
        jPInfoNino.add(jRadioButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 300, -1, -1));

        jRadioButton4.setText("No");
        jPInfoNino.add(jRadioButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(135, 300, -1, -1));

        jLabel13.setText("Sellado");
        jPInfoNino.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(387, 304, -1, -1));

        jRadioButton5.setText("Si");
        jPInfoNino.add(jRadioButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(561, 300, -1, -1));

        jRadioButton6.setText("No");
        jPInfoNino.add(jRadioButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(594, 300, -1, -1));

        jLabel14.setText("Integrante del Coro");
        jPInfoNino.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 330, -1, -1));

        jRadioButton7.setText("Si");
        jPInfoNino.add(jRadioButton7, new org.netbeans.lib.awtextra.AbsoluteConstraints(84, 326, -1, -1));

        jRadioButton8.setText("No");
        jPInfoNino.add(jRadioButton8, new org.netbeans.lib.awtextra.AbsoluteConstraints(154, 326, -1, -1));

        jButton2.setText("jButton2");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPInfoNino.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(375, 351, -1, -1));

        jButton3.setName("jbFotoNino"); // NOI18N
        jPInfoNino.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 10, 150, 120));

        jtpppal.addTab("Informacion Basica del Niño (a)", jPInfoNino);

        jPInfoFamiliares.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel15.setText("ID");
        jPInfoFamiliares.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 15, -1, -1));
        jPInfoFamiliares.add(jTextField6, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 12, 199, -1));

        jLabel16.setText("Primer Nombre");
        jPInfoFamiliares.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));
        jPInfoFamiliares.add(jTextField7, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 50, 199, 20));

        jLabel17.setText("Segundo Nombre");
        jPInfoFamiliares.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 40, -1, 25));
        jPInfoFamiliares.add(jTextField8, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 40, 226, -1));

        jLabel18.setText("Primer Apellido");
        jPInfoFamiliares.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, -1, -1));
        jPInfoFamiliares.add(jTextField9, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 90, 199, -1));

        jLabel19.setText("Segundo Apellido");
        jPInfoFamiliares.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 90, -1, -1));
        jPInfoFamiliares.add(jTextField10, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 80, 226, -1));

        jLabel20.setText("Telefono");
        jPInfoFamiliares.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, -1, -1));
        jPInfoFamiliares.add(jTextField11, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 130, 199, -1));

        jButton1.setText("Buscar");
        jPInfoFamiliares.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 10, 70, -1));

        jtpppal.addTab("Informacion de Familiares", jPInfoFamiliares);

        jPinfoResponsables.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel21.setText("Por favor rellene lla siguiente tabla con los familiares del niño");
        jPinfoResponsables.add(jLabel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, -1, -1));

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "ID", "Primer Nombre", "Segundo Nombre", "Primer Apellido", "Segundo Apellido", "Telefono", "Direccion", "Barrio", "Cristiano"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jTable1);

        jPinfoResponsables.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, 770, 260));

        jtpppal.addTab("Informacion de Responsables", jPinfoResponsables);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addGap(267, 267, 267))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtpppal, javax.swing.GroupLayout.DEFAULT_SIZE, 838, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jtpppal, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)
                .addGap(37, 37, 37))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        
        try {
           // Class.forName("oracle.jdbc.driver.OracleDriver");
            Class.forName("oracle.jdbc.OracleDriver");
            String BaseDeDatos = "jdbc:oracle:thin:@localhost:1521:SIIPUC2013_DATOS";
          BaseDeDatos="jdbc:oracle:thin:@localhost:1521:XE";
         
         
         Connection conn;
        //conn= DriverManager.getConnection("jdbc:oracle:oci:@XE", "SIIPUC_2013", "a123456");
          //               @TNSNames_Entry,  userid,  password
         conn=DriverManager.getConnection(BaseDeDatos, "SIIPUC_2013", "a123456");
         
         if (conn != null) {
            
            jTf_PNombNino.setText("Conexion exitosa!");
            } else {
            jTf_PNombNino.setText("Conexion fallida!");
            }
         
         
         Statement sentencia;
            sentencia = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            
            
          ResultSet resultado;
          resultado= sentencia.executeQuery("select TABLE_NAME from user_tables");
         
          while (resultado.next())
          {
          jTf_PNombNino.setText( jTf_PNombNino.getText() + resultado.getString("TABLE_NAME"));
          }
          
          /*
    Statement stmt = conn.createStatement();
    ResultSet rset = 
              stmt.executeQuery("select table_name from user_tables");
    while (rset.next())
         // System.out.println (rset.getString(1));   // Print col 1
        jTf_PNombNino.setText(rset.getString(0));
    stmt.close();
         */
        } catch (Exception e) {
         jTf_PNombNino.setText("Hola me llamo felix");
         e.printStackTrace();
        }
          // Connection hola= new DriverManager.getConnection("jdbc:oracle:oci:@ORACLEBD", "SIIPUC_2013", "a123456");
        
        
    }//GEN-LAST:event_jButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JComboBox jComboBox1;
    private com.toedter.calendar.JDateChooser jDateChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPInfoFamiliares;
    private javax.swing.JPanel jPInfoNino;
    private javax.swing.JPanel jPinfoResponsables;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JRadioButton jRadioButton8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField11;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JTextField jTf_PNombNino;
    private javax.swing.JTextField jTf_Snomb_nino;
    private javax.swing.JTabbedPane jtpppal;
    // End of variables declaration//GEN-END:variables
}
